]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Close when source actor gets hidden
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 17 Dec 2019 00:01:13 +0000 (01:01 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Fri, 20 Dec 2019 14:20:49 +0000 (14:20 +0000)
If a menu is anchored to a source actor, it is odd to leave it floating
around when the source actor gets hidden.

Close the menu instead in that case.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2002

js/ui/popupMenu.js

index c3e763b36955614d9c7f83ba516aab1e25b9e429..56638050f9589a427d4b4cb5c3f7b2247ac86e8d 100644 (file)
@@ -814,7 +814,12 @@ var PopupMenu = class extends PopupMenuBase {
 
         if (this.sourceActor) {
             this._keyPressId = this.sourceActor.connect('key-press-event',
-                                                        this._onKeyPress.bind(this));
+                this._onKeyPress.bind(this));
+            this._notifyMappedId = this.sourceActor.connect('notify::mapped',
+                () => {
+                    if (!this.sourceActor.mapped)
+                        this.close();
+                });
         }
 
         this._systemModalOpenedId = 0;
@@ -928,6 +933,9 @@ var PopupMenu = class extends PopupMenuBase {
         if (this._keyPressId)
             this.sourceActor.disconnect(this._keyPressId);
 
+        if (this._notifyMappedId)
+            this.sourceActor.disconnect(this._notifyMappedId);
+
         if (this._systemModalOpenedId)
             Main.layoutManager.disconnect(this._systemModalOpenedId);
         this._systemModalOpenedId = 0;